set vbuttonNum to the spriteNum of me - (the firstSprite of me - 1)
case vbuttonNum of
1:
set the Letter of me to #a
2:
set the Letter of me to #b
3:
set the Letter of me to #c
4:
set the Letter of me to #d
end case
setPrevChoice(me)
end
on setPrevChoice me
set chosenOne to getAt(the clickChoices of gClueData, the questionNum of me)
if chosenOne = the Letter of me then
sendSprite(the spriteNum of me, #Toggle)
end if
end
on mouseDown me
set chosenOne to getAt(the clickChoices of gClueData, the questionNum of me)
if chosenOne = the Letter of me then
setAt(the clickChoices of gClueData, the questionNum of me, 0)
else
if chosenOne <> #e then
unclickAnother(me, chosenOne)
end if
setAt(the clickChoices of gClueData, the questionNum of me, the Letter of me)
end if
end
on unclickAnother me, prevChoice
case prevChoice of
#a:
set vNumber to 1
#b:
set vNumber to 2
#c:
set vNumber to 3
#d:
set vNumber to 4
end case
set otherSprite to the firstSprite of me + (vNumber - 1)
sendSprite(otherSprite, #Toggle)
end
on getPropertyDescriptionList
set p_list to [#questionNum: [#comment: "Question number for this button:", #format: #integer, #range: [#min: 1, #max: 21], #default: 1], #firstSprite: [#comment: "First sprite of series:", #format: #integer, #range: [7, 8, 9, 10], #default: 7]]
return p_list
end
on getBehaviorDescription
return "Each sprite will know its position in a group based on its sprite number." & RETURN & "It will also know what question it is applied to." & RETURN & "From these properties we can keep score in a global." & RETURN & "• Question number - choose from the range." & RETURN & "• First sprite - so the first sprite in the series gets a 1, etc." & RETURN & "NOTES:" & RETURN & "Uses global variable to keep track of button position, ON or OFF."